package com.thb.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSONObject;

public class ResponseTool {
	
	private static final Logger logger = LoggerFactory.getLogger(ResponseTool.class); 
	
	public static String returns(Object object){
		JSONObject obj = new JSONObject();
		obj.put("msg", "处理数据成功");
		obj.put("code", "0000");
		obj.put("data", object);
		
		String json = JSONUtil.beanToJson(obj);
		
		logger.info(String.format("the return data is:%s", json));
		return json;
	}
	
	public static String returns(){
		JSONObject obj = new JSONObject();
		obj.put("msg", "处理数据成功");
		obj.put("code", "0000");
		obj.put("data", new JSONObject());
		
		String json = JSONUtil.beanToJson(obj);
		
		logger.info(String.format("the return data is:%s", json));
		return json;
	}

}
